-
Notifications
You must be signed in to change notification settings - Fork 121
[In-app Purchases] Include purchase result in purchaseProduct API #8133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Generated by 🚫 dangerJS |
|
|
||
| func purchaseProduct(with id: String, for remoteSiteId: Int64) async throws { | ||
| _ = try await withCheckedThrowingContinuation { continuation in | ||
| func purchaseProduct(with id: String, for remoteSiteId: Int64) async throws -> StoreKit.Product.PurchaseResult { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to keep StoreKit references inside the boundaries of the IAP interface if possible, so their clients don't have to even import it. That way we have WPComPlanProduct that acts as a facade of the StoreKit.Product, hiding any details about StoreKit. Can we do the same with StoreKit.Product.PurchaseResult? With a protocol or a typealias?
typealias PurchaseResult = StoreKit.Product.PurchaseResult
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good call, I'll add that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in ded8c4c
|
Thanks for this addition! Now the purchase outcome is more meaningful. |
You can test the changes from this Pull Request by:
|
Closes: #8130
Description
This updates the
InAppPurchasesForWPComPlansProtocol.purchaseProductso it returns the actualPurchaseResultand the site creation flow is able to differentiate a successful purchase from a pending one or a user cancellation.Testing instructions
Purchase result: userCancelledmessage in the consolePurchase result: success(...message in the consoleRELEASE-NOTES.txtif necessary.